/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ListRendererPrestacion.java
 *
 * Created on Apr 10, 2011, 11:23:09 AM
 */

package frontera.interfaz.listRenderer;

import entidad.Prestacion;
import java.awt.Color;
import java.awt.Component;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 *
 * @author tuareg
 */
public class ListRendererPrestacion extends javax.swing.JPanel implements ListCellRenderer {

    /** Creates new form ListRendererPrestacion */
    public ListRendererPrestacion() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelNombre = new javax.swing.JLabel();
        labelPorEmpleado = new javax.swing.JLabel();
        labelPorCompañia = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 255));
        setMaximumSize(new java.awt.Dimension(126, 172));
        setLayout(new java.awt.GridLayout(1, 0));

        labelNombre.setText("Nombre");
        add(labelNombre);

        labelPorEmpleado.setText("Porcentaje Empleado");
        add(labelPorEmpleado);

        labelPorCompañia.setText("Porcentaje Compañia");
        add(labelPorCompañia);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel labelNombre;
    private javax.swing.JLabel labelPorCompañia;
    private javax.swing.JLabel labelPorEmpleado;
    // End of variables declaration//GEN-END:variables

    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Prestacion prestacion = (Prestacion)value;

            labelNombre.setText(prestacion.getNombre());
            labelPorEmpleado.setText(prestacion.getPorcentajeEmpleado());
            labelPorCompañia.setText(prestacion.getPorcentajeCompañia());

            if(isSelected){
                this.setBackground(new Color(200, 200, 255));
            }
            else{
                this.setBackground(new Color(255, 255, 255));
            }

            return this;
    }

}
